//
//  MineViewContrller.m
//  specialine
//
//  Created by 往返网络 on 17/2/7.
//  Copyright © 2017年 com. All rights reserved.
//

#import "MineViewContrller.h"
#import "SendViewController.h"
#import "SendViewController.h"
#import "ReceiveViewController.h"
#import "MineViewContrller.h"
#import "KefuViewController.h"  //客服中心
#import "HuiyuanViewController.h"  //会员中心
#import "AdvertiseViewController.h"  //意见反馈
#import "PesonalCenterViewController.h"  //我的——个人中心（更改密码）
#import "ScannerViewController.h" //扫描界面
#import "ChongzhiViewController.h" //充值
#import "MoreViewController.h" //交易记录
#import "ZhuanzhangViewController.h" //转账
#import "BankViewController.h" //银行卡
#import "TixianViewController.h" //提现
#import "SearchViewController.h" //搜索页面id号
#import "SearchListViewController.h" //搜索列表页
#import "PublicMethod.h"
#define centerbtn_tag  1000 // 个人中心按钮
#define search_tag 1001
#define scanner_tag 1002
#define kefu_tag 2000 //我的客服
#define lishi_tag 2001  //历史消息
#define fankui_tag 2002  //意见反馈
#define begin_x  30.0/W_BASE*SCREEN_W
#define min_h  80.0/H_BASE*SCREEN_H
//定义登录URL
#define URL_Mine [NSString stringWithFormat:@"%@/Appcustomernewer/Personal/index?type=get",BASE_URL]
//定义查询银行卡URL
#define URL_CHECKBANK [NSString stringWithFormat:@"%@/Appcustomernewer/Pay/payMyCard?type=get",BASE_URL]

@interface MineViewContrller ()
@property (nonatomic,strong)AFHTTPSessionManager* manger;
@property (nonatomic,copy)NSString * is_password; //是否设置过登录密码

@end
@implementation MineViewContrller
{

    UIButton * searbtn ;//搜索btn
    UIButton * scanbtn ;//扫描btn
    UIImageView * iconimage; //头像
    UILabel * namelabel;
    UILabel * phonelabel;
    UIButton * centerbtn; //个人中心btn
    UILabel * yuenumlab;//余额钱数lab
    UIButton * kefubtn; //客服
    UIButton * exitbtn; //退出
    NSString * phonestr;
    NSString * balance; // 账户余额
    
}
- (void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
    self.navigationController.navigationBar.hidden = YES;
//    [self loadData]; //切换界面时，余额刷新
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated{

    self.navigationController.navigationBar.hidden = NO;

}
- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self createUI];
  //  监听手机号更改，修改主页面的帐号信息
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeUsername) name:@"CHANGE" object:nil];
    //监听推出登录，充值。提现 。转账成功之后，刷新主页的余额
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(loadData) name:@"REFRESH"object:nil];
    // Do any additional setup after loading the view.
}
#pragma mark -  - - - --  - 更改账户名   － － － － －－ －
- (void)changeUsername{
    
    NSUserDefaults * user = [NSUserDefaults standardUserDefaults];
    phonestr = [user objectForKey:USERDEFAULTS_PHONE];
    phonelabel.text = phonestr;
}
- (void)receivenotice{
    
       [self loadData];
}

#pragma mark  -- - - - - - -- - - - - 请求数据，获得本地信息  -- - - - - - -- - - - - - - -
- (void)loadData{
    
    //请求账号信息，余额等，赋值。。
    UIImageView * im = [PublicMethod startAnimation];
    
    NSString * token = [[NSUserDefaults standardUserDefaults]objectForKey:USER_TOCKE];
    
    NSString * url = [NSString stringWithFormat:@"%@&token=%@",URL_Mine,token];
    NSLog(@"金额刷新");
    NSLog(@"mine url %@",url);
    
    [self.manger GET:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        if (responseObject) {
            
            NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            
            NSInteger code = [dict[@"code"]integerValue];
            
            if (code == 0) {
                // 停止动画
                [im stopAnimating];
                NSDictionary * dic = dict[@"info"];
                NSString  * balancestr = dic[@"balance"];
                balance = balancestr;
                self.is_password  = [NSString stringWithFormat:@"%@",dic[@"is_password"]];
                yuenumlab.text = [NSString stringWithFormat:@"%@",balance];
                
            }else{
                
                [im stopAnimating];
                ALERT(@"提示", dict[@"info"], self, @"确定", nil);
                if (code == 2) {
                //token失效，请重新登录
                    [PublicMethod enterNewMain];
                
                }
                
            }
            
        }
        
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        
        ALERT(@"提示", @"网络请求失败", self, @"确定", nil);
        
        [im stopAnimating];
        
    }];

}

- (void)createUI{

    float fontsize = 17;
    
    fontsize = SCREEN_H < 667 ? 15 : 19;
    
    if (SCREEN_H == 667) {
    
        fontsize = 17;
    }
    
    self.view.backgroundColor = COLORRGBA(239, 239, 239, 1);
    
    //设置表头

    UIImageView * im = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_W, 300.0/H_BASE*SCREEN_H)];
    im.image = [UIImage imageNamed:@"mineback_.png"];
    
    [self.view addSubview:im];
    
    //title
    
    UILabel * titlelab = [[UILabel alloc]initWithFrame:CGRectMake(0, 20.0, SCREEN_W, 90.0/H_BASE*SCREEN_H)];
    
    titlelab.text = @"我的";
    
    titlelab.textColor = [UIColor whiteColor];
    
    [self.view addSubview:titlelab];
    
    titlelab.textAlignment = NSTextAlignmentCenter;
    
    titlelab.font = [UIFont systemFontOfSize:fontsize];
    
    //iconimg ＋30
    
    iconimage = [[UIImageView alloc]initWithFrame:CGRectMake(30.0/W_BASE*SCREEN_W, CGRectGetMaxY(titlelab.frame)+ 30.0/H_BASE*SCREEN_H, 100.0/W_BASE*SCREEN_W, 100.0/H_BASE*SCREEN_H)];
    
    [self.view addSubview:iconimage];
    
    iconimage.image = [UIImage imageNamed:@"mineicon_.png"];
    
    namelabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(iconimage.frame)+10.0/W_BASE*SCREEN_W, CGRectGetMinY(iconimage.frame), 360.0/W_BASE*SCREEN_W, 50.0/H_BASE*SCREEN_H)];
    
    namelabel.textColor = [UIColor whiteColor];
    
    namelabel.text = @"个人账号";
    
    namelabel.font = [UIFont systemFontOfSize:fontsize];
    
    [self.view addSubview:namelabel];
    
    phonelabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(namelabel.frame), CGRectGetMaxY(namelabel.frame), CGRectGetWidth(namelabel.frame), CGRectGetHeight(namelabel.frame))];
    
    NSUserDefaults * user = [NSUserDefaults standardUserDefaults];
    
    NSString * phone = [user objectForKey:USERDEFAULTS_PHONE];
    
    phonelabel.text = phone;
    
    phonelabel.font = [UIFont systemFontOfSize:fontsize];
    
    phonelabel.textColor = [UIColor whiteColor];
    
    [self.view addSubview:phonelabel];
    
    
    centerbtn = [[UIButton alloc]initWithFrame:CGRectMake(680.0/W_BASE*SCREEN_W, CGRectGetMinY(namelabel.frame), 70.0/W_BASE*SCREEN_W, CGRectGetHeight(namelabel.frame))];
    
    
    centerbtn.titleLabel.font = [UIFont fontWithName:@"iconfont" size:fontsize+5];
    
    [centerbtn setTitle:@"\U0000e6a7" forState:UIControlStateNormal];
    
    [centerbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    centerbtn.titleLabel.textAlignment = NSTextAlignmentCenter;
    
    centerbtn.center = CGPointMake(centerbtn.center.x, iconimage.center.y);

    [self.view addSubview:centerbtn];
  
    //搜索btn
    UILabel * searlab = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_W - 80.0/W_BASE*SCREEN_W , 45.0/H_BASE*SCREEN_H, 80.0/W_BASE*SCREEN_W, min_h)];
    searlab.textAlignment = NSTextAlignmentCenter;
    searlab.text = @"\U0000e6ac";
    searlab.font = [UIFont fontWithName:@"iconfont" size:fontsize];
    searlab.textColor = [UIColor whiteColor];
//    [self.view addSubview:searlab];
    searbtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_W - 260.0/W_BASE*SCREEN_W, 0, 260.0/W_BASE*SCREEN_W, 115.0/H_BASE*SCREEN_H)];
    [searbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:searbtn];
    searbtn.tag = search_tag;
    
    //扫一扫btn
    UILabel * scanlab = [[UILabel alloc]initWithFrame:CGRectMake(32.0/W_BASE*SCREEN_W , 45.0/H_BASE*SCREEN_H, 80.0/W_BASE*SCREEN_W, min_h)];
    scanlab.textAlignment = NSTextAlignmentLeft;
    scanlab.text = @"\U0000e6ec";
    scanlab.font = [UIFont fontWithName:@"iconfont" size:fontsize];
    scanlab.textColor = [UIColor whiteColor];
//    [self.view addSubview:scanlab];
    scanbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 260.0/W_BASE*SCREEN_W, 115.0/H_BASE*SCREEN_H)];
    [scanbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:scanbtn];
    scanbtn.tag = scanner_tag;
    
    
    //扩大相应区域
    
    UIButton * bigbtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_W * 0.5, CGRectGetMinY(iconimage.frame), SCREEN_W*0.5, CGRectGetHeight(iconimage.frame))];
    
    [self.view addSubview:bigbtn];
    
    [bigbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
    
    bigbtn.tag = centerbtn_tag;
    
    
    UIView * view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 300.0/H_BASE*SCREEN_H, SCREEN_W,min_h)];
    
    view1.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:view1];
    
    UILabel * yue = [[UILabel alloc]initWithFrame:CGRectMake(begin_x, 0, 220.0/W_BASE*SCREEN_W, min_h)];
    
    yue.textColor = [UIColor blackColor];
    
    yue.font = [UIFont systemFontOfSize:fontsize - 3];
    
    yue.text = @"余额(元)";
    
    [view1 addSubview:yue];
    
    yue.textAlignment  = NSTextAlignmentLeft;
    
    yuenumlab = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_W -280.0/W_BASE*SCREEN_W, 0, 250.0/W_BASE*SCREEN_W, min_h)];
    yuenumlab.font  = [UIFont fontWithName:@"iconfont" size:fontsize -3];
    yuenumlab.textAlignment = NSTextAlignmentRight;
    yuenumlab.text = @"100.00";
    [view1 addSubview:yuenumlab];
    
    
    
    //创建下方表格
    
    UIView * view2 = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(view1.frame)+40.0/H_BASE*SCREEN_H, SCREEN_W, min_h*2)];
    
    view2.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:view2];
    
    
//    NSArray * titlearr = @[@"充值",@"提现",@"转账",@"银行卡",@"交易记录"];
//    NSArray * iconarr = @[@"\U0000e635",@"\U0000e626",@"\U0000e609",@"\U0000e606",@"\U0000e6b1"];

    NSArray * titlearr = @[@"提现",@"交易记录"];
    NSArray * iconarr = @[@"\U0000e626",@"\U0000e6b1"];
    NSArray * colorarr = @[COLORRGBA(51, 204, 153, 1),COLORRGBA(228, 77, 255, 1)];
    for (NSInteger i = 0; i<2; i++) {
        UIButton * chongzhibtn = [[UIButton alloc]initWithFrame:CGRectMake(0, min_h*i, SCREEN_W, min_h)];
        chongzhibtn.backgroundColor = [UIColor whiteColor];
        [view2 addSubview:chongzhibtn];
        chongzhibtn.tag = 2002+i;
        [chongzhibtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
        UILabel * iconlab = [[UILabel alloc]initWithFrame:CGRectMake(20.0/W_BASE*SCREEN_W, 0, 50.0/W_BASE*SCREEN_W, min_h)];
        iconlab.font = [UIFont fontWithName:@"iconfont" size:fontsize ];
        iconlab.text = iconarr[i];
        iconlab.textColor = colorarr[i];
        [chongzhibtn addSubview:iconlab];
        iconlab.textAlignment = NSTextAlignmentRight;
        
        UILabel * titlelab = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(iconlab.frame)+20.0/W_BASE*SCREEN_W, 0, 150.0/W_BASE*SCREEN_W, min_h)];
        titlelab.text = titlearr[i];
        [chongzhibtn addSubview:titlelab];
        titlelab.font  = [UIFont systemFontOfSize:fontsize -3];
        
        UILabel * rightlab = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_W - 80.0/W_BASE*SCREEN_W , 0, 80.0/W_BASE*SCREEN_W, min_h)];
        rightlab.textAlignment = NSTextAlignmentCenter;
        rightlab.text = @"\U0000e6a7";
        rightlab.font = [UIFont fontWithName:@"iconfont" size:fontsize];
        rightlab.textColor = COLORRGBA(153, 153, 153, 1);
        [chongzhibtn addSubview:rightlab];
    }
    for (NSInteger i = 1; i<2; i++) {
        UIView * breakline = [[UIView alloc]initWithFrame:CGRectMake(0, min_h*i, SCREEN_W, 1)];
        breakline.backgroundColor = COLORRGBA(239, 239, 239, 1);
        [view2 addSubview:breakline];
    }
  
    kefubtn = [[UIButton alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(view2.frame)+30.0/H_BASE*SCREEN_H, SCREEN_W, min_h)];
    
    kefubtn.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:kefubtn];
    
    [kefubtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
    
    kefubtn.tag = 2007;
    
    UILabel * iconlab = [[UILabel alloc]initWithFrame:CGRectMake(20.0/W_BASE*SCREEN_W, 0, 50.0/W_BASE*SCREEN_W, min_h)];
    iconlab.font = [UIFont fontWithName:@"iconfont" size:fontsize];
    iconlab.text = @"\U0000e604";
    iconlab.textColor = COLORRGBA(38, 146, 255, 1);
    [kefubtn addSubview:iconlab];
    iconlab.textAlignment = NSTextAlignmentRight;
    UILabel * titlab = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(iconlab.frame)+20.0/W_BASE*SCREEN_W, 0, 150.0/W_BASE*SCREEN_W, min_h)];
    titlab.text = @"我的客服";
    [kefubtn addSubview:titlab];
    titlab.font  = [ UIFont systemFontOfSize:fontsize -3];
    
    UILabel * rightlab = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_W - 80.0/W_BASE*SCREEN_W , 0, 80.0/W_BASE*SCREEN_W, min_h)];
    rightlab.textAlignment = NSTextAlignmentCenter;
    rightlab.text = @"\U0000e6a7";
    rightlab.font = [UIFont fontWithName:@"iconfont" size:fontsize];
    rightlab.textColor = COLORRGBA(153, 153, 153, 1);
    [kefubtn addSubview:rightlab];
    
}

//创建一个返回富文本的方法

-(NSMutableAttributedString*) changeLabelWithText:(NSString*)needText andStartplace:(NSString *)startplace andendplae:(NSString *)endplace andfontsize:(float)fontsize
{
    
    //
    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:needText];
    
    NSInteger startlength = startplace.length;
    
    NSInteger endlength = endplace.length;
    
    // 设置起始地字符大小－ －格式
    [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:fontsize+6] range:NSMakeRange(0,startlength)];
    // 设置终止地字符大小－ －格式
    
    [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:fontsize] range:NSMakeRange(needText.length - endlength , endlength)];
    
    //设置中间字符••••••
    // [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:fontsize - 4] range:NSMakeRange(startlength,needText.length-startlength-endlength)];
    
    return attrString;
    
    
}


#pragma mark - - - -- - - -- - Aciton -- - - - -- - - -


- (void)enterClick:(UIButton *)btn{


    NSInteger tag = btn.tag;
    
    KefuViewController * kefu = [[KefuViewController alloc]init];
    
    ScannerViewController * scannvc = [[ScannerViewController alloc]init];
    
    ChongzhiViewController * chonzhivc = [[ChongzhiViewController alloc]init];
    
//    AdvertiseViewController * adver = [[AdvertiseViewController alloc]init];
    
    PesonalCenterViewController * personal = [[PesonalCenterViewController alloc]init];
    
    switch (tag) {
            
        case centerbtn_tag:
            //进入个人中心
            personal.is_password  = self.is_password;
            [self.navigationController pushViewController:personal animated:YES];
            
            break;
        case scanner_tag:
            //扫描
            NSLog(@"进入扫描");
            [self.navigationController pushViewController:scannvc animated:YES];
            break;
        case search_tag:
            //搜索
        {
            NSLog(@"进入搜索");
            SearchListViewController * searchvc  = [[SearchListViewController alloc]init];
            [self.navigationController pushViewController:searchvc animated:YES];
            break;
        }
//        case 2002:
//            //充值
//            NSLog(@"充值");
////            [self.navigationController pushViewController:chonzhivc animated:YES];
//            [self checkBank:chonzhivc];
//            break;
//        case 2003:
//            //提现
//        { NSLog(@"提现");
//            TixianViewController * tixianvc = [[TixianViewController alloc]init];
//            tixianvc.balance  = balance;
//            [self.navigationController pushViewController:tixianvc animated:YES];
//            [self checkBank:tixianvc];
//            break;
//        }
//        case 2004:
//        {  NSLog(@"转账");
//            ZhuanzhangViewController * zhuanzhangvc = [[ZhuanzhangViewController alloc]init];
////            [self.navigationController pushViewController:zhuanzhangvc animated:YES];
//            [self checkBank:zhuanzhangvc];
//            break;
//        }
//        case 2005:
//        { NSLog(@"银行卡");
//            BankViewController * bankvc = [[BankViewController alloc]init];
//            [self.navigationController pushViewController:bankvc animated:YES];
//            break;
//        }
//        case 2006:
//        { NSLog(@"交易记录");
//            MoreViewController * jiaoyivc = [[MoreViewController alloc]init];
//            [self.navigationController pushViewController:jiaoyivc animated:YES];
//            break;
//        }
        case 2002:
            //提现
        { NSLog(@"提现");
            TixianViewController * tixianvc = [[TixianViewController alloc]init];
            tixianvc.balance  = balance;
            //            [self.navigationController pushViewController:tixianvc animated:YES];
            [self checkBank:tixianvc];
            break;
        }
        case 2003:
        { NSLog(@"交易记录");
            MoreViewController * jiaoyivc = [[MoreViewController alloc]init];
            [self.navigationController pushViewController:jiaoyivc animated:YES];
            break;
        }

        case 2007:
            NSLog(@"我的客服");
            [self.navigationController pushViewController:kefu animated:YES];
            break;
            

//
//        case lishi_tag:
//            
//            //会员
////            NSLog(@"历史消息");
//            
//            [self.navigationController pushViewController:huiyuan animated:YES];
//
//            
//            break;
//            
//        case fankui_tag:
//            
//            //反馈
////            NSLog(@"反馈");
//            
//            [self.navigationController pushViewController:adver animated:YES];
//
//            
//            break;
//    
//          case exit_tag:
//            
//            NSLog(@"退出");
//            
//        
//            [self QUIT];
//
            break;
            
            
        default:
            break;
            
            
    }


}
- (void)checkBank:(UIViewController *)vc{
    
    //请求当前有没有银行卡，银行卡的信息等
    // 有银行卡，view2显示，view1隐藏
    
    //请求账号信息，余额等，赋值。。
    UIImageView * ima = [PublicMethod startAnimation];
    
    NSString * token = [[NSUserDefaults standardUserDefaults]objectForKey:USER_TOCKE];
    
    NSString * url = [NSString stringWithFormat:@"%@&token=%@",URL_CHECKBANK,token];
    
    NSLog(@"查询当前有没有银行卡 url %@",url);
    
    [self.manger GET:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        if (responseObject) {
            
            NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            NSInteger code = [dict[@"code"]integerValue];
            if (code == 0) {
                // 停止动画
                [ima stopAnimating];
                NSDictionary * result = dict[@"info"];
                NSString * open_id = result[@"open_id"];
                NSLog(@"open_id %@",open_id);
                if (open_id.length !=0) {
                    //有银行卡
                   // 跳转对应的界面
                    [self.navigationController pushViewController:vc animated:YES];
                    
                }else{
                    //没有银行卡
                    ALERT(@"提示", @"亲，需要去网页版(www.91zxt.cn)去绑卡哟～", self, @"确定", nil);
                    //进入绑定银行卡界面
//                    BankViewController * bankvc = [[BankViewController alloc]init];
//                    [self.navigationController pushViewController:bankvc animated:YES];
                }
                
            }else{
                [ima stopAnimating];
                ALERT(@"提示", dict[@"info"], self, @"确定", nil);
            }
            
        }
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        ALERT(@"提示", @"网络请求失败", self, @"确定", nil);
        [ima stopAnimating];
        
    }];
}

#pragma mark - - -- - - - 懒加载 ---- - -- - -

- (AFHTTPSessionManager*)manger{
    
    
    if (!_manger) {
        
        
        _manger = [AFHTTPSessionManager manager];
        
        _manger.responseSerializer = [AFHTTPResponseSerializer serializer];
        
        _manger.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html",@"application/json", nil];
        
    }
    
    return _manger;
    
    
}

- (void)didReceiveMemoryWarning {
    
    [super didReceiveMemoryWarning];
    
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
